Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine

Partial Class Reportes_Controls_ctlCrReporteEstadoSocio
    Inherits System.Web.UI.UserControl
    Protected Sub btnRefrescar_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        BindReport()

    End Sub

    

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'If Not IsPostBack Then
        BindReport()
        'End If
    End Sub

    Private Sub BindReport()

        If Session("RepEstado") Is Nothing Then
            Dim ConnInfo As New ConnectionInfo
            With ConnInfo
                .ServerName = "."
                .DatabaseName = "Club"
                .UserID = "sa"
                .Password = "587412302"
            End With

            Dim rep As New ReportDocument
            rep.Load(Server.MapPath("~/Reportes/arcReportes/rptReporteEstadoSocio.rpt"))
            Me.CrystalReportViewer1.ReportSource = rep
            Dim RepTbls As Tables = rep.Database.Tables
            For Each RepTbl As Table In RepTbls
                Dim RepTblLogonInfo As TableLogOnInfo = RepTbl.LogOnInfo
                RepTblLogonInfo.ConnectionInfo = ConnInfo
                RepTbl.ApplyLogOnInfo(RepTblLogonInfo)
            Next
            Session("RepEstado") = rep
        End If

        Me.CrystalReportViewer1.ReportSource = Session("RepEstado")
        Me.CrystalReportViewer1.DataBind()
    End Sub

End Class
